package com.hx.rpc.consumer.proxy;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.concurrent.EventExecutorGroup;

/**
 * @author Huathy
 * @date 2021-10-23 17:00
 * @description
 */
public class RpcProxyHandler extends ChannelInboundHandlerAdapter {
    private Object resp;
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        this.resp = msg;
        System.out.println("[log info] ==> 客户端收到msg："+ msg);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
    }

    public Object getResponse() {
        return resp;
    }
}
